import { _decorator, Component, Node } from 'cc';
import { GlobalUpdateManager } from './GlobalUpdateManager';
const { ccclass, property } = _decorator;

@ccclass('Test')
export class Test extends Component {
    start() {}

    update(deltaTime: number) {}

    globalUpdateTest() {
        GlobalUpdateManager.instance.enable();
        setTimeout(() => {
            GlobalUpdateManager.instance.add((dt) => {
                console.log('High priority update', dt);
            }, 10);

            GlobalUpdateManager.instance.add(
                (dt) => {
                    console.log('Run once');
                },
                0,
                true,
            );

            setTimeout(() => {
                GlobalUpdateManager.instance.disable();
            }, 2000);
        }, 1000);
    }
}
